const fs = require('fs')
const path = require('path')

let fireName = '买辣椒也用券 - 起风了'
let firepath = path.join('f:/Music/', fireName + '.lrc')
let writefirepath = path.join(__dirname, './lyric.js')

let geci = []

fs.readFile(firepath, 'utf8', function(err, res){
  // console.log(err, res)
  if(err){
    console.log('文件读取失败')
  }

  let str = res.split("\n")
  for(let i =0; i<str.length; i++){
    str[i] = str[i].replace(/(^\s*)|(\s*$)/g, ""); //去除前后空格
    str[i] = "'" + str[i] + "'"
  }

  geci = `let lyr = [${str}]
          export default lyr;
  `

  fs.writeFile(writefirepath, geci, function(err, res){
    console.log(res)
  })
})